Skip to content

fix(reports): a report's PDF reaches DOCiD once its embargo ends (prod) - #1701

Open
sickerine wants to merge 1 commit into
prodfrom
fix/docid-embargo-file-prod
Open

sickerine wants to merge 1 commit into
prodfrom
fix/docid-embargo-file-prod

Conversation

@sickerine

Copy link
Copy Markdown
Collaborator

Ports #1694 to prod and nothing else: one commit cherry-picked onto origin/prod. dev is not merged in. Don't merge or deploy without a decision from the team.

The bug. A report published with an embargo never got its PDF on DOCiD. The deposit sends the file only when anyone may get it. When the embargo ended, openEmbargoes registered the report again, but the registrar only updated DOCiD's title, description and DOI.

The fix. It is the same as #1694:

  • When a report DOCiD holds is open and DOCiD doesn't have its PDF, the registrar adds it with doi-sync-core's addFile (feat(docid): add a file to a deposited record, once doi-sync-core#25, pinned at its merge commit 1571758). DOCiD gives the file a Handle of its own, kept on the report as registrations.docid.fileHandle.
  • addFile reads the record's files first, so a lost answer or a file the deposit already carried is found and never sent twice.
  • A PDF over DOCiD's 25 MB limit for an added file is left out. The registration is done, and its error says why.
  • Each add is logged (report-docid-file-add, report-docid-file-added, report-docid-file-too-large).

Differences from #1694. The test file keeps prod's tests (dev's ISSN-correction test isn't on prod), and prod has no accountsId, so the new test doesn't clear it.

Proven on shared dev (#1694, Convex pushed at 7d65ae6, DOCiD Sandbox):

  • Test report R100748 went live with DOCiD and an embargo. It was deposited without a file: Handle 20.500.14351/54f691a4ead7bdb82ca7, demo record 5275, publications_files: [].
  • Its embargo was moved to 2026-12-02, and reports/fileAccess:openEmbargoes ran after midnight UTC.
  • Record 5275 now holds cb377aac6cbd_R100748.pdf: Report type, "Full text", CC-BY-4.0, 2026-11, its own Handle 20.500.14351/0efb9984d7833f3f5386. The report keeps that Handle as fileHandle, with no registration error. The file downloads as a PDF, and DOCiD's public get-publication/5275 lists it.

What prod needs. No migration: fileHandle is a new optional field. No new env var. Prod's DOCiD is already in Custom mode with the production account (user 203), and the embargo cron already runs there. The Convex push has to come from a checkout with npm install run after this pin.

Effect on prod's data, read 2026-12-02. Prod has 6 live reports on DOCiD (R100012, R100015, R100016, R100018, R100020, R100021). All are open, and their deposits carried the PDF. None is embargoed. On each one's next registration, the registrar reads the record's files once and keeps the Handle it finds, with no upload and no mint. Production DOCiD lists those files as <12 hex>_R1000NN.pdf, read-only for records 6833 and 6837, which the client matches. The largest of their PDFs is R100015's, at 11.8 MB.

Checks on this branch: npx tsc --noEmit, and vitest on convex/reports/{registration,identifiers,paper}.test.ts (31 passed).

A deposit carries the PDF only when anyone may get it, and DOCiD's update route can't add a file. When a report DOCiD already holds opens (an embargo ending, or a reviewer opening a private file), the registrar now adds its PDF to the record through doi-sync-core's addFile, which looks for it on the record first so a retry never mints a second Handle. The file's Handle is kept on the report's DOCiD registration (fileHandle), so it is never sent again. A PDF over DOCiD's 25 MB limit is left out: the registration is done and its error says why. Every add is logged with DOCiD's answer and the Handle.
@coderabbitai

coderabbitai Bot commented Dec 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 737b14d8-e81f-443b-a916-5caa93874b1d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T00:06:44.326019Z e3f0971 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant